<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!--suppress HtmlRequiredTitleElement -->
<head>
    <th:block th:include="include :: header('菜单权限表')"/>
    <link rel="stylesheet" th:href="@{/static/assets/system/css/menu.css}">
</head>
<body class="layui-layout-body theme-himio">
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">菜单名称:</label>
                        <div class="layui-input-inline">
                            <input name="menuName" class="layui-input" placeholder="请输入菜单名称"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">菜单状态:</label>
                        <div class="layui-input-inline">
                            <label>
                                <select name="visible" th:with="type=${@dict.getType('sys_show_hide')}">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                            th:value="${dict.dictValue}"></option>
                                </select>
                            </label>
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="menuTbSearch" lay-submit>
                            <i class="layui-icon layui-icon-search"></i>搜索
                        </button>
                    </div>
                </div>
            </form>
            <!-- 数据表格 -->
            <table id="menuTable" lay-filter="menuTable"></table>
        </div>
    </div>
</div>

<!--表格操作工具按钮-->
<script type="text/html" id="menuTbBar">
    <a class="layui-btn layui-bg-blue layui-btn-sm icon-btn" lay-event="edit" shiro:hasPermission="system:menu:edit"><i
            class="fa fa-edit"></i>修改</a>
    <a class="layui-btn layui-bg-cyan layui-btn-sm icon-btn" lay-event="add" shiro:hasPermission="system:menu:add"><i
            class="fa fa-plus-square"></i>新增</a>
    <a class="layui-btn layui-btn-danger layui-btn-sm icon-btn" lay-event="del"
       shiro:hasPermission="system:menu:remove"><i class="fa fa-trash"></i>删除</a>
</script>


<!-- 表单弹窗 edit -->
<script type="text/html" id="menuEditDialog">
    <form id="menuEditForm" lay-filter="menuEditForm" class="layui-form model-form">
        <input name="menuId" type="hidden"/>
        <input name="isRefresh" type="hidden" value="0"/>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">菜单名称:</label>
            <div class="layui-input-block">
                <input name="menuName" placeholder="请输入菜单名称" class="layui-input" lay-verType="tips"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">上级菜单: <i class="fa fa-question-circle-o"
                                                                         lay-tips="分配到指定菜单下，例如 系统管理"></i></label>
            <div class="layui-input-block">
                <div id="gen-menu-tree" class="xm-select-demo" style="width: 300px;"></div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">显示顺序:</label>
            <div class="layui-input-block">
                <input name="orderNum" placeholder="请输入显示顺序" class="layui-input" lay-verType="tips"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">菜单地址:</label>
            <div class="layui-input-block">
                <!--                <input name="url" placeholder="请输入请求地址" class="layui-input" lay-verType="tips" value="#"/>-->
                <div id="menuUrl" class="xm-select-demo"></div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">打开方式:</label>
            <div class="layui-input-block">
                <label>
                    <select name="target" th:with="type=${@dict.getType('sys_menu_target')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:selected="${dict.default}"></option>
                    </select>
                </label>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">菜单类型:</label>
            <div class="layui-input-block">
                <input type="radio" th:each="dict : ${@dict.getType('sys_menu_type')}" th:id="${dict.dictCode}"
                       lay-filter="menuType"
                       name="menuType" th:value="${dict.dictValue}" th:title="${dict.dictLabel}"
                       th:checked="${dict.default}"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">菜单状态:</label>
            <div class="layui-input-block">
                <input type="radio" th:each="dict : ${@dict.getType('sys_show_hide')}" th:id="${dict.dictCode}"
                       name="visible" th:value="${dict.dictValue}" th:title="${dict.dictLabel}"
                       th:checked="${dict.default}"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">权限标识:</label>
            <div class="layui-input-block">
                <input name="perms" placeholder="请输入权限标识" class="layui-input" lay-verType="tips"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">菜单图标:</label>
            <div class="layui-input-block">
                <input name="icon" placeholder="点击输入框选择图标" class="layui-input" onclick="selectIcon();" autocomplete="off"/>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="menuEditSubmit" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>


<!-- js部分 -->
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var addFlag = [[${@permission.hasPermit('system:menu:add')}]];
    var editFlag = [[${@permission.hasPermit('system:menu:edit')}]];
    var removeFlag = [[${@permission.hasPermit('system:menu:remove')}]];
    var exportFlag = [[${@permission.hasPermit('system:menu:export')}]];
    var dictSysShowHide = [[${@dict.getType('sys_show_hide')}]];
    var dictSysMenuType = [[${@dict.getType('sys_menu_type')}]];

    var allMenuTree = [[${allMenu}]];
    var urlSet = [[${urlSet}]];
    var prefix = ctx + "system/menu";
    var $ = layui.jquery;
</script>
<script th:src="@{/static/assets/system/js/menu.js}"></script>
</body>
</html>

